<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Index extends Controller_Template {

    public function before()
    {
        parent::before();
        
        if ($this->auto_render === TRUE)
        {
            $this->title = 'PHP302.COM';
            $this->_config->title = ' - php,javascript,mysql,linux';
            $this->navigate->add('PHP302.COM');
            
            $this->template->content_right(hook('sidebar'));
        }
    }

    public function after()
    {
        if ($this->auto_render === TRUE)
        {
        	;
        }
        
        parent::after();
    }
    
	public function action_index()
	{
		$list = MON::factory('article')->find();
		
		$this->pagination = new Pagination(array(
			'total_items'=>$list->count()
		));
		
		$list
		->skip($this->pagination->offset)
		->limit($this->pagination->items_per_page)
		->sort(array('addTime'=>-1));
		
		$this->content = lib_view::factory('default')
		->set('list',$list);
	}
} // End Welcome
